<?php
	include "./application/core/session.php";
	
	#LIBRARY
		include DIR_LIBRARY 	. "EmailLib.php";
	
	#MODEL
		include DIR_MODEL		. "globalMod.php";
		include DIR_MODEL		. "announcementMod.php";
		include DIR_MODEL		. "departmentSubjectCourseMod.php";
		include DIR_MODEL 		. "personalInformationMod.php";
		include DIR_MODEL 		. "studentInformationMod.php";
		
	#CONTROLLER
		include DIR_CONTROLLER	. "globalCon.php";
		include DIR_CONTROLLER 	. "personalInformationCon.php";
		include DIR_CONTROLLER 	. "studentInformationCon.php";
		include DIR_CONTROLLER	. "departmentSubjectCourseCon.php";
		include DIR_CONTROLLER	. "announcementCon.php";
	
	$ANNOUNCE 	= new WS_AnnouncementCon();
	$PI  		= new WS_PersonalInformationCon();
	$STUD  		= new WS_StudentInformationCon();
	$DSC 		= new WS_DepartmentSubjectCourseCon();
	$globalCon 	= new WS_GlobalCon();
	$EMAIL		= new WS_Email();

	$getVar = $_GET['page'];

	if (!empty($getVar)) {

		if ( ((!empty($_SESSION['WB_Login'])) && ($_SESSION['WB_Login'] == 'Y')) || (!empty($_COOKIE['WB_Cookie'])) ) {

			$logUserID 		= $globalCon->globalLogID();
		
			$getActiveYear 	= $globalCon->getActiveYear();
			$activeYear 	= $getActiveYear['year_idPK'];
			$yearFrom 		= $getActiveYear['year_from'];
			$yearTo 		= $getActiveYear['year_to'];
			$yearSummer 	= $getActiveYear['is_summer'];
			$__SYR__		= ($yearFrom == $yearTo) ? $yearFrom : $yearFrom .'-'.$yearTo;
		
			if ( ($_SESSION['WB_AccType'] == 'S') || ($_COOKIE['WB_Account'] == 'S') ) {
				
				$strStudPictureName = $globalCon->getStudentPictureName($logUserID);
				$strPicture 	= $strStudPictureName['picture'];
				$strName		= $strStudPictureName['name'];
				$strAccNo		= $strStudPictureName['stud_no'];
				$strCourseID	= $strStudPictureName['course_idPK'];
				$strCourseCode	= $strStudPictureName['course_code'];
				$strCourseDec	= $strStudPictureName['course_desc'];
				
				$strStudentSection = $globalCon->getStudentSection($logUserID);
				$strSectionID	= $strStudentSection['section_idPK'];
				$strSectionDec	= $strStudentSection['section_desc'];
			}
			else {
				$strPictureName = $globalCon->getPictureName($logUserID);
				$strPicture 	= $strPictureName['picture'];
				$strName		= $strPictureName['name'];
				$strAccNo		= $strPictureName['account_no'];
				$strAccType		= $strPictureName['account_type'];
				$strAccDept		= $strPictureName['dept_idFK'];
				$strAccCourse	= $strPictureName['dept_desc'];
			}
			
		}
		
		switch($getVar) {
			case 'ForgotPassword'				: 	include "./application/mvc/scripts/iframe/forgotPasswordRequest.php";			break;
			case 'NewComersRegistration'		: 	include "./application/mvc/scripts/iframe/registrationNewComers.php";			break;
			
			case 'PersonalInformation'			: 	($_SESSION['WB_AccType'] == 'S') || ($_COOKIE['WB_Account'] == 'S') 
													?	include "./application/mvc/scripts/iframe/studentPersonalInformation.php"	
													:	include "./application/mvc/scripts/iframe/personalInformation.php";			break;
			case 'ChangePicture'				: 	($_SESSION['WB_AccType'] == 'S') || ($_COOKIE['WB_Account'] == 'S') 
													?	include "./application/mvc/scripts/iframe/studentChangePicture.php"	
													:	include "./application/mvc/scripts/iframe/changePicture.php";				break;
			case 'ChangePassword'				: 	($_SESSION['WB_AccType'] == 'S') || ($_COOKIE['WB_Account'] == 'S') 
													?	include "./application/mvc/scripts/iframe/studentChangePassword.php"	
													:	include "./application/mvc/scripts/iframe/changePassword.php";				break;
													
			case 'StudentRequestPassword'		: 	include "./application/mvc/scripts/iframe/studentRequestPassword.php";			break;
			case 'ViewProfile'					: 	include "./application/mvc/scripts/iframe/viewProfile.php";						break;
			case 'ViewAnnouncement'				: 	include "./application/mvc/scripts/iframe/viewAnnouncement.php";				break;
			case 'SubjectPrintPreview'			: 	include "./application/mvc/scripts/iframe/subjectPrintPreview.php";				break;
			case 'TransferyCredits'				: 	include "./application/mvc/scripts/iframe/transferyCredits.php";				break;
			case 'NewAccount'					: 	include "./application/mvc/scripts/iframe/newAccount.php";						break;
			case 'StudentProfile'				: 	include "./application/mvc/scripts/iframe/studentProfile.php";					break;
			case 'StudentCurrentSubjectTaken'	: 	include "./application/mvc/scripts/iframe/studCurrentSubjTaken.php";			break;
			case 'SetFacultySchedule'			: 	include "./application/mvc/scripts/iframe/setFacultySchedule.php";				break;
			case 'EvaluationChecklist'			: 	include "./application/mvc/scripts/iframe/eveluationChecklist.php";				break;
			case 'SchedulePerSection'			: 	include "./application/mvc/scripts/iframe/schedulePerSection.php";				break;
			case 'EditStudentSection'			: 	include "./application/mvc/scripts/iframe/editStudentSection.php";				break;
			case 'PrintStudentSearch'			: 	include "./application/mvc/scripts/iframe/printStudentSeach.php";				break;
			case 'PrintStudentGradesSearch'		: 	include "./application/mvc/scripts/iframe/printStudentGradesSearch.php";		break;
			case 'AdminStudentChangePassword'	: 	include "./application/mvc/scripts/iframe/deanStudentChangePassword.php";		break;
			case 'RequestStudentSection'		: 	include "./application/mvc/scripts/iframe/requestStudentSection.php";			break;
			case 'SchedulePerSectionIrregular'	: 	include "./application/mvc/scripts/iframe/schedulePerSectionIrregular.php";		break;
			case 'IRRequestStudentSubject'		: 	include "./application/mvc/scripts/iframe/requestIrregularStudentSubject.php";	break;
			case 'ScheduleSectionIrregular'		: 	include "./application/mvc/scripts/iframe/scheduleSectionIrregular.php";		break;
			case 'IRRequestStudentSection'		: 	include "./application/mvc/scripts/iframe/irRequestStudentSection.php";			break;
			case 'NewSemesterSY'				: 	include "./application/mvc/scripts/iframe/newSemesterSY.php";					break;
			
			default								: 	include "./application/mvc/scripts/iframe/error404.php";						break;
		}

		$TEMP->set_var(array('log_name' 		=> $strName,
						 	 'log_account_no' 	=> $strAccNo,
							 'dir_css' 			=> DIR_CSS,
							 'dir_js' 			=> DIR_JS,
							 'dir_image' 		=> DIR_IMAGES
							 ));

	$TEMP->printParse('handle');

	}
	else {
		echo "<center>Connection Error: Please Refresh Your Page.</center>";
	}
	
?>